import Vue from 'vue'
import VueRouter from 'vue-router'
import LoginView from '@/views/loginView'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        redirect: '/login',
        component: LoginView

    },
    {
        path: '/login',
        name: 'login',
        component: () => import('@/views/loginView.vue')
    },
    {
        path: '/HomeView',
        name: 'HomeView',
        component: () => import('@/views/home/HomeView.vue')
    },
    {
        path: '/Accon',
        name: 'Accon',
        component: () => import('@/views/Accon.vue')
    },
    {
        path: '/',
        redirect: '/home',
        component: () => import('@/layout/layout.vue'),
        children: [
            {
                path: '/home',
                name: 'home',
                component: () => import('@/views/home/HomeView.vue')
            }
        ]
    },
    {
        path: '/loan',
        redirect: '/loan/index',
        component: () => import('@/layout/layout.vue'),
        children: [
            {
                meta:
                    {title: '申请贷款'},
                path: '/loan/index',
                name: 'loan',
                component: () => import('@/views/loan/index.vue'),
            }
        ]
    },
]

const router = new VueRouter({
    routes,
})

export default router
